
<%- model_class = Post.new.class -%>

<div class="page-header"><h1>News<%#=t '.title', :default => model_class.model_name.human.pluralize %></h1></div>


<% if can? :create, Post %>
<%= link_to t('.new', :default => t("helpers.links.new")),new_post_path, :class => 'btn btn-primary' %> 
<%end%>





<table class="table table-striped">
  <thead>
    <tr>
<% @posts.each do |post| %>
	
      <th><%#= model_class.human_attribute_name(:title) %></th>
      <th>
		<%= post.title %><%#= model_class.human_attribute_name(:description) %>	
		<% if current_user %>
   		<%= link_to "Copy to FB Wall", post_path(post),  :class => 'btn btn-mini btn-success alert-success' %><%#%>
   		<%else%>
   		<%nil%>
   		<%end%>
		
		</th>
	<% if can? :create, Post %>
	  <th><%= model_class.human_attribute_name(:id) %></th>
      <th><%= model_class.human_attribute_name(:created_at) %></th>
      <th><%=t '.actions', :default => t("helpers.actions") %></th>
	<%end%>
    </tr>
  </thead>
  <tbody>
	
      <tr>
        <td>
		</td>
        <td><%= post.description %></td>
		<% if can? :create, Post %>
		<td><%= link_to post.id, post_path(post), :class => 'btn btn-mini btn-danger' %></td>
        <td><%=l post.created_at %></td>
		<%end%>
        <td>
		<% if can? :update, @post %>
          <%= link_to t('.edit', :default => t("helpers.links.edit")),
                      edit_post_path(post), :class => 'btn btn-mini btn-inverse' %>
		<%end%>
		<% if can? :destroy, @post %>
          <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
                      post_path(post),
                      :method => :delete,
                      :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
                      :class => 'btn btn-mini btn-danger' %>
		<%end%>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= paginate @posts %>


